package state;

import main.Game;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;

import constans.Flag;
import constans.ResourceManager;

import button.*;

public class MenuState extends State {

	private Button[] button;
	private Button button1;
	private Button button2;
	private Button button3;
	private Button button5;
	
	public MenuState()
	{
		background = ResourceManager.getImage("background");
		button = new Button[4];
		button[0] = new StandardButton(310,250,200,50,Flag.GAMEPLAY_STATE,ResourceManager.getImage("b_singlePlayer"),ResourceManager.getSound("click"));
		button[1] = new StandardButton(310,310,200,50,Flag.MULTIPLAYER_STATE,ResourceManager.getImage("b_mutliplayer"),ResourceManager.getSound("click"));
		button[2] = new StandardButton(310,370,200,50,Flag.AUTHOR_STATE,ResourceManager.getImage("b_author"),ResourceManager.getSound("click"));
		button[3] = new StandardButton(310,490,200,50,Flag.QUIT_STATE,ResourceManager.getImage("b_quit"),ResourceManager.getSound("click"));
		buttonsBcg = ResourceManager.getImage("menu_buttonsBcg");
		
		//na razie
		button[1].setActivity(false);
	}
	public void render(GameContainer container, Graphics g) throws SlickException
	{	
		super.render(container, g);
		
		buttonsBcg.draw(300, 240);
		for(Button b:button)
			b.render(container, g);
	}
	public void update(GameContainer container, int delta) throws SlickException
	{
		Input input = container.getInput();
		for(Button b:button)
			{
				b.hover(input);
				stateFlag = b.click(input);
				if(b.wasClicked()) Game.setState(stateFlag);
			}
	}

}
